#include "3adCode.hpp"

#include <iostream>
#include <string>

typedef std::string String;

void showCodeInstruction(CodeInstruction opCode) {
	String s;
	switch (opCode) {
		case OPCODE_NONE: s = "nop";break;
		case OPCODE_ADD: s = "+";break;
		case OPCODE_SUB: s = "-";break;
		case OPCODE_MUL: s = "*";break;
		case OPCODE_DIV: s = "/";break;
		case OPCODE_NEG: s = "-";break;
		case OPCODE_AND: s = "&";break;
		case OPCODE_OR: s = "|";break;
		case OPCODE_NOT: s = "!";break;
		case OPCODE_CPY: s = ":=";break;
		case OPCODE_LT: s = "<";break;
		case OPCODE_GT: s = ">";break;
		case OPCODE_LE: s = "<=";break;
		case OPCODE_GE: s = ">=";break;
		case OPCODE_EQ: s = "==";break;
		case OPCODE_NEQ: s = "!=";break;
		case OPCODE_JMP: s = "aller";break;
		case OPCODE_JMPC: s = "";break;
		case OPCODE_ART: s = "";break;
		case OPCODE_ALT: s = "";break;
		case OPCODE_PTR: s = "&";break;
		case OPCODE_RRT: s = "*";break;
		case OPCODE_RLT: s = "";break;
		case OPCODE_PSH: s = "push";break;
		case OPCODE_PSA: s = "";break;
		case OPCODE_PSP: s = "";break;
		case OPCODE_PSR: s = "";break;
		case OPCODE_POP: s = "pop";break;
		case OPCODE_PPA: s = "";break;
		case OPCODE_PPR: s = "";break;
		case OPCODE_CLL: s = "call";break;
		case OPCODE_RET: s = "return";break;
		case OPCODE_RETV: s = "return";break;
		case OPCODE_END: s = "end";break;
	}

	std::cout << " " << s << " " << std::flush;
}
